package com.proton.carepatchtemp.utils;

import android.app.Activity;

/**
 * Created by Api on 2016/9/21.
 */
//判断数据有效性
public class JudgeUtils {

    public static boolean isZero(String likes) {
        return likes == null || "null".equalsIgnoreCase(likes) || "".equalsIgnoreCase(likes) || "0".equalsIgnoreCase(likes) || "-".equalsIgnoreCase(likes);
    }

    public static boolean invalidStr(String str) {
        return str == null || "null".equalsIgnoreCase(str) || "".equalsIgnoreCase(str);
    }

    public static boolean validStr(String str) {
        return !invalidStr(str);
    }

    public static boolean validUrl(String str) {
        return validStr(str) && str.startsWith("http:");
    }

    public static boolean sameActvt(Activity actvt0, Activity actvt1) {
        if (actvt0 == null || actvt1 == null || actvt0.getLocalClassName() == null || actvt1.getLocalClassName() == null) {
            return false;
        }
        return actvt0.getLocalClassName().equalsIgnoreCase(actvt1.getLocalClassName());
    }

    public static boolean sameActvt(Class<?> actvt0, Activity actvt1) {

        if (actvt0 == null || actvt1 == null || actvt0.getSimpleName() == null || actvt1.getClass() == null || actvt1.getClass().getSimpleName() == null) {
            return false;
        }
        return actvt0.getSimpleName().equalsIgnoreCase(actvt1.getClass().getSimpleName());
    }


}
